/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/*
 * MainProgram.java
 *
 * Created on 18 ม.ค. 2553, 11:08:43
 */
package testpackage;

import java.awt.BorderLayout;
import warehouse.PnlCreateCreditors;
import warehouse.PnlEditEmployee;
import warehouse.PnlEditPr;
import warehouse.PnlListCreditor;
import warehouse.PnlListPr;

/**
 *
 * @author werapan
 */
public class MainProgram extends javax.swing.JFrame {

    /** Creates new form MainProgram */
    public MainProgram() {
        initComponents();
    }

    /** This method is called from within the constructor to
     * initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is
     * always regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        tbarMainProgram = new javax.swing.JToolBar();
        btnFirstButton = new javax.swing.JButton();
        btnSecondButton = new javax.swing.JButton();
        jSplitPane1 = new javax.swing.JSplitPane();
        jScrollPane1 = new javax.swing.JScrollPane();
        jTree1 = new javax.swing.JTree();
        jScrollPane2 = new javax.swing.JScrollPane();
        panelMain = new javax.swing.JDesktopPane();
        jMenuBar1 = new javax.swing.JMenuBar();
        menuStore = new javax.swing.JMenu();
        smenuTest1 = new javax.swing.JMenuItem();
        menuWarehouse = new javax.swing.JMenu();
        menuAdministrator = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setMinimumSize(new java.awt.Dimension(900, 600));

        tbarMainProgram.setRollover(true);

        btnFirstButton.setText("กดดิ 1");
        btnFirstButton.setFocusable(false);
        btnFirstButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnFirstButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbarMainProgram.add(btnFirstButton);

        btnSecondButton.setText("กดดิ 2");
        btnSecondButton.setFocusable(false);
        btnSecondButton.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSecondButton.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSecondButton.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSecondButtonActionPerformed(evt);
            }
        });
        tbarMainProgram.add(btnSecondButton);

        getContentPane().add(tbarMainProgram, java.awt.BorderLayout.PAGE_START);

        jScrollPane1.setMinimumSize(new java.awt.Dimension(200, 25));
        jScrollPane1.setPreferredSize(new java.awt.Dimension(200, 482));
        jScrollPane1.setViewportView(jTree1);

        jSplitPane1.setLeftComponent(jScrollPane1);

        panelMain.setBackground(java.awt.Color.red);
        jScrollPane2.setViewportView(panelMain);

        jSplitPane1.setRightComponent(jScrollPane2);

        getContentPane().add(jSplitPane1, java.awt.BorderLayout.CENTER);

        menuStore.setText("หน้าร้าน");
        menuStore.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                menuStoreActionPerformed(evt);
            }
        });

        smenuTest1.setText("ทดสอบ 1");
        smenuTest1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                smenuTest1ActionPerformed(evt);
            }
        });
        menuStore.add(smenuTest1);

        jMenuBar1.add(menuStore);

        menuWarehouse.setText("หลังร้าน");
        jMenuBar1.add(menuWarehouse);

        menuAdministrator.setText("ดูแลระบบ");
        jMenuBar1.add(menuAdministrator);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btnSecondButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSecondButtonActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_btnSecondButtonActionPerformed

    private void smenuTest1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_smenuTest1ActionPerformed
        // TODO add your handling code here:
        // TODO add your handling code here:

        PnlEditEmployee pnlEditPr =new PnlEditEmployee();
        PnlListCreditor pnlListPr = new PnlListCreditor();
        IFrameTest frame = new IFrameTest();
        frame.setPnlEdit(pnlEditPr);
        frame.setPnlList(pnlListPr);

        frame.setVisible(true);
        panelMain.setLayout(new BorderLayout());
        panelMain.add(frame,BorderLayout.CENTER);
        try {
            frame.setSelected(true);
        } catch (java.beans.PropertyVetoException e) {
        }
    }//GEN-LAST:event_smenuTest1ActionPerformed

    private void menuStoreActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_menuStoreActionPerformed


    }//GEN-LAST:event_menuStoreActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                try {
                    //javax.swing.UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
                    javax.swing.UIManager.setLookAndFeel(javax.swing.UIManager.getSystemLookAndFeelClassName());


                } catch (Exception e) {
                    System.out.println(e);
                }
                new MainProgram().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btnFirstButton;
    private javax.swing.JButton btnSecondButton;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JSplitPane jSplitPane1;
    private javax.swing.JTree jTree1;
    private javax.swing.JMenu menuAdministrator;
    private javax.swing.JMenu menuStore;
    private javax.swing.JMenu menuWarehouse;
    private javax.swing.JDesktopPane panelMain;
    private javax.swing.JMenuItem smenuTest1;
    private javax.swing.JToolBar tbarMainProgram;
    // End of variables declaration//GEN-END:variables
}
